<template>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide" v-for="(lunboImg,index) in activities" :key="index"><a :href="detailTaocao(lunboImg.itemId)"><img :src="lunboImg.image[0]" /></a></div>
        </div>
        <div class="swiper-pagination"></div>
    </div>
</template>

<script>
import Swiper from 'swiper'
export default {
    name: 'Lunbo',
    props:{
        activities:{
            type:Array,
            required:true,
            default:() => {
                return [];
            }
        }
    },
    methods:{
        detailTaocao(itemId) {
            return "/taocandetail?itemId=" + itemId;
        }
    },
    mounted(){
        //兼容异步图片处理  swiper ，设定延迟时间为1秒 初始化。
        setTimeout(()=>{
            new Swiper('.swiper-container', {
                initialSlide:0,
                autoHeight: true,
                spaceBetween: 20,
                loop: true,
                autoplay: {
                    delay: 2500,
                    disableOnInteraction: false,
                },
                pagination: {
                    el: '.swiper-pagination',
                    clickable: true
                }
            });
        },1000)
    },
}
</script>


<style lang="scss">
@import "../assets/style/bjfw.scss";
</style>
